package com.anyou.use.service.impl;

import java.util.List;
import com.anyou.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.anyou.use.mapper.UseUserAddressMapper;
import com.anyou.use.domain.UseUserAddress;
import com.anyou.use.service.IUseUserAddressService;

/**
 * 用户收货地址Service业务层处理
 * 
 * @author gaochaohao
 * @date 2022-03-08
 */
@Service
public class UseUserAddressServiceImpl implements IUseUserAddressService 
{
    @Autowired
    private UseUserAddressMapper useUserAddressMapper;

    /**
     * 查询用户收货地址
     * 
     * @param addressId 用户收货地址主键
     * @return 用户收货地址
     */
    @Override
    public UseUserAddress selectUseUserAddressByAddressId(Long addressId)
    {
        return useUserAddressMapper.selectUseUserAddressByAddressId(addressId);
    }

    /**
     * 查询用户收货地址列表
     * 
     * @param useUserAddress 用户收货地址
     * @return 用户收货地址
     */
    @Override
    public List<UseUserAddress> selectUseUserAddressList(UseUserAddress useUserAddress)
    {
        return useUserAddressMapper.selectUseUserAddressList(useUserAddress);
    }

    /**
     * 新增用户收货地址
     * 
     * @param useUserAddress 用户收货地址
     * @return 结果
     */
    @Override
    public int insertUseUserAddress(UseUserAddress useUserAddress)
    {
        useUserAddress.setCreateTime(DateUtils.getNowDate());
        return useUserAddressMapper.insertUseUserAddress(useUserAddress);
    }

    /**
     * 修改用户收货地址
     * 
     * @param useUserAddress 用户收货地址
     * @return 结果
     */
    @Override
    public int updateUseUserAddress(UseUserAddress useUserAddress)
    {
        useUserAddress.setUpdateTime(DateUtils.getNowDate());
        return useUserAddressMapper.updateUseUserAddress(useUserAddress);
    }

    /**
     * 批量删除用户收货地址
     * 
     * @param addressIds 需要删除的用户收货地址主键
     * @return 结果
     */
    @Override
    public int deleteUseUserAddressByAddressIds(Long[] addressIds)
    {
        return useUserAddressMapper.deleteUseUserAddressByAddressIds(addressIds);
    }

    /**
     * 删除用户收货地址信息
     * 
     * @param addressId 用户收货地址主键
     * @return 结果
     */
    @Override
    public int deleteUseUserAddressByAddressId(Long addressId)
    {
        return useUserAddressMapper.deleteUseUserAddressByAddressId(addressId);
    }
}
